//
//  NSString+hash.m
//  helper
//
//  Created by huangyi on 12-10-29.
//  Copyright (c) 2012年 huangyi. All rights reserved.
//

#import "NSString+hash.h"
#import "NSData+hash.h"

@implementation NSString (hash)

- (NSData *)md2{
    NSData *data=[self dataUsingEncoding:NSUTF8StringEncoding];
    return data.md2;
}

- (NSData *)md4{
    NSData *data=[self dataUsingEncoding:NSUTF8StringEncoding];
    return data.md4;
}

- (NSData *)md5{
    NSData *data=[self dataUsingEncoding:NSUTF8StringEncoding];
    return data.md5;
}

- (NSData *)sha1{
    NSData *data=[self dataUsingEncoding:NSUTF8StringEncoding];
    return data.sha1;
}

- (NSData *)sha224{
    NSData *data=[self dataUsingEncoding:NSUTF8StringEncoding];
    return data.sha224;
}

- (NSData *)sha256{
    NSData *data=[self dataUsingEncoding:NSUTF8StringEncoding];
    return data.sha256;
}

- (NSData *)sha384{
    NSData *data=[self dataUsingEncoding:NSUTF8StringEncoding];
    return data.sha384;
}

- (NSData *)sha512{
    NSData *data=[self dataUsingEncoding:NSUTF8StringEncoding];
    return data.sha512;
}

-(NSData *)sha1hmac:(NSString*)key{
    NSData *data=[self dataUsingEncoding:NSUTF8StringEncoding];
    return [data sha1hmac:key];
}

@end
